@model Order

@{
    var pageName = "Details";
    ViewData["Title"] = pageName;
}

<h2>@pageName</h2>

<div>
    <h4>Order</h4>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.FirstName)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.FirstName)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.LastName)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.LastName)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.AddressLine1)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.AddressLine1)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.AddressLine2)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.AddressLine2)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.ZipCode)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.ZipCode)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.City)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.City)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.State)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.State)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.Country)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.Country)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.PhoneNumber)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.PhoneNumber)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.OrderPlaced)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.OrderPlaced)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.Email)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.Email)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.User)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.User.Email)
        </dd>
        <dt>
            <br />----- Order
        </dt>
        <dd>
            <br /><b>Details -----</b>
        </dd>
        @{decimal subtotal = 0M;}
        @foreach (OrderDetail orderDetail in ViewBag.OrderDetailsList)
        {
            <dt>
                @Html.DisplayNameFor(model => orderDetail.Pizza)
            </dt>
            <dd>
                @Html.DisplayFor(model => orderDetail.Pizza.Name)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => orderDetail.Amount)
            </dt>
            <dd>
                @Html.DisplayFor(model => orderDetail.Amount)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => orderDetail.Price)
            </dt>
            <dd>
                    @orderDetail.Price.ToString("c")
            </dd>
            <dt>
                Sub Total
            </dt>
            <dd>
                @{subtotal = orderDetail.Price * orderDetail.Amount;}
                @subtotal.ToString("c")
            </dd>
            <dt>
                <br />
            </dt>
            <dd>
                <br />
            </dd>
        }
        <dt>
            Total Price
        </dt>
        <dd>
            @Model.OrderTotal.ToString("c")
        </dd>
        
    </dl>
</div>
<div>
    @*<a asp-action="Edit" asp-route-id="@Model.OrderId">Edit</a> |*@
    <a asp-action="Index">Back to List</a>
</div>
